import java.util.Arrays;

public class MaopaoSort {

    public static void main(String[] args) {
        int[] arr = {1, 3, 5, 2, 1, 0};
        for(int i = 0; i < arr.length - 1; i++){
            boolean flg = false;
            for(int j = 0; j < arr.length - 1 - i; j++) {
                if(arr[j] > arr[j+1]){
                    int t = arr[j];
                    arr[j] = arr[j+1];
                    arr[j+1] = t;
                    flg = true;
                }
            }
            if(flg == false){
                break;
            }
        }
        System.out.println(Arrays.toString(arr));
    }
}
